'use strict'//严格模式

//第一题
console.log('第一题');
var arr1=[1,2,3,4]
var i=0
var ni=0
for(i=0;i<arr1.length;i++){
    var ni=arr1[i]+ni
}
console.log(ni);

//第二题
console.log('第二题');
var arr2=[1,2,3,4,2]
var item=2;
var newArr2=arr2.slice();
var ci1= newArr2.indexOf(2);

newArr2.splice(ci1,1);
var ci2= newArr2.indexOf(2);
newArr2.splice(ci2,1);
console.log(newArr2);

//第三题
console.log('第三题');
var arr3=[1,2,2,3,4,2,2,]
for(var i=0;i<2;i++){
    var ci3= arr3.indexOf(item);
    arr3.splice(ci3,2)
}
console.log(arr3);

//第四题
console.log('第四题');
var arr4=[1,2,3,4];
console.log(arr4);
var item4=10;
var newArr4=arr4.slice();
newArr4.push(10);
console.log(arr4);

//第五题
console.log('第五题');
var arr5=[1,2,3,4];
var newArr5=arr5.slice();
console.log(arr5);
 newArr5.pop();
console.log(newArr5);

//第六题
console.log('第六题');
var arr6=[1,2,3,4];
var item6=10;
var newArr6=arr6.slice();
newArr6.unshift(item6);
console.log(newArr6);        

//第七题
console.log('第七题');
let arr7=[1,2,3,4];
let newArr7=arr7.slice();
newArr7.splice(0,1);
console.log(newArr7);

//第八题
console.log('第八题');
let arr81=[1,2,3,4]
let arr82=['a','b','c',1]
let newArr8=arr81.concat(arr82);
console.log(newArr8);

//第九题
console.log('第九题');
let arr9=[1,2,3,4];
let index9=2;
let item9='z';
let newArr9=arr9.slice();
let c9= newArr9.indexOf(item9);
newArr9.splice(c9,0,item9);
console.log(newArr9);